<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="font-awesome-4.5.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="css/selectize.css">
    <link rel="stylesheet" href="css/selectize.bootstrap3.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/buttons.css">
    <link rel="stylesheet" type="text/css" href="css/wangEditor.min.css">
    <link rel="stylesheet" href="css/toastr.css">
    <style type="text/css">
    .ng-binding{overflow:hidden;}
    .table>tbody>tr>td{line-height:normal;}
    </style>
</head>
<body>
<?php 
$nav='home';
include_once './view/_top.php';
?>
<div class="container-fluid content" id="content">
    <!-- ngView:  --><div class="ng-scope"><div class="container-fluid content ng-scope" id="content">
    <div class="sidebar">
        <ul class="nav nav-sidebar">
          <?php if (1 == $_SESSION['uid']){ ?>
            <li id="b" class="active"><a href="?a=home">小票信息</a></li>
          <?php }else{ ?>
            <li id="c"  ><a href="?a=send">小票信息</a></li>
            <li id="d" class="active"><a href="?a=pay">小票支付</a></li>
          <?php } ?>
        </ul>
    </div>
    <div class="main smain">
        <div class="main-cont" style="min-width: 1064px">
            <?php 
           	 	$query = $this->mysqli->query("select id,ispay from piao where shen='yes' ");
           	 	$countAll=0;
           	 	$countPay=0;
            	while($list=$query->fetch_array()){
            		if('yes' !=  $list['ispay']){
            			$countPay++;
            		}
            		$countAll++;
            	}
            
            ?>
            <div>
                                          总共 <?php echo $countAll; ?> 张小票  通过审核 <br /><br />
                <?php echo $countPay; ?> 张小票，红包未发送 <br /><br />
                                           微信商户平台需要充值: <?php echo $countPay; ?>*20= <?php echo $countPay*20; ?>元 <br /><br />
                <span style="font-size:12px;color:red;">点击 支付操作 的 ‘同意支付’ 按钮后 ，程序后台会自动在工作时间内，
                定时发放微信红包，并更新支付状态</span>
            </div>

            <div style="margin-top: 50px">
                 
                <div class="hr-line-dashed"></div>
                <table class="table table-striped tables">
                    <tbody>
                    <tr>
                        <th>UID</th>
                        <th>支付操作</th>
                        <th>审核状态</th>
                        <th>支付状态</th>
                        <th>小票编号</th>
                        <th>用户昵称</th>
                        <th>用户头像</th>
                        <th>姓名</th>
                        <th>手机号</th>
                        <th>门店</th>
                        <th>小票照片</th>
                        <th>参与时间</th>
                        <th style="text-align: left">操作</th>
                    </tr>
                    <?php 

                    if (isset($_GET['p'])) {
                    	$page=$_GET['p'];
                    }else{
                    	$page=1;
                    }
                    $pageSize=10;
                    
                     
                    $sql="select count(id) as count from `piao` where shen='yes' ";
                    
                    $query_count = $this->mysqli->query($sql);
                    $row=$query_count->fetch_array();
                    $total=$row['count'];
                    $total_page=1;
                    if ($total) {
                    	if($total % $pageSize){
                    		$total_page=(int)($total/$pageSize)+1;
                    	}else{
                    		$total_page=($total/$pageSize);
                    	}
                    }
                    
                     
                    $sql="select * from piao where shen='yes' and (ispay is NULL or ispay='agree' )order by id desc limit ".($page-1)*$pageSize.", $pageSize ";
                     
                    $query = $this->mysqli->query($sql);
                    while ($list=$query->fetch_array()){
                    	$querywx= $this->mysqli->query("select nickname,headimgurl from users where id='".$list['uid']."' limit 0,1 ");
                        $wxInfo=$querywx->fetch_array();
                    ?>
                    <tr  class="ng-scope">
                        <td class="ng-binding"><?php echo $list['uid']; ?></td>
                        <td style="text-align: left">
                          <?php if ('agree' == $list['ispay']){ ?>
                                                                                             已同意
                          <?php }else{ ?>
                            <a  href="#" data-id="<?php echo $list['id']; ?>" class="mymodal3 button button-primary button-pill button-small">同意支付</a>
                          <?php } ?>  
                         </td>
                        <td class="ng-binding"><?php 
                            if(empty($list['shen'])){
                            	echo '未审核';
                            }elseif ('yes' == $list['shen']){
                            	echo '<span style="color:red;">审核通过</span>';
                            }elseif ('no' == $list['shen']){
                            	echo '未通过审核';
                            }
                        
                        
                        ?></td>
                        
                        <td class="ng-binding"><?php 
                        	if ('yes' == $list['shen']){
                        		if ('yes' == $list['ispay']){
                        			echo '<span style="color:red;">已付</span>';
                        		}else if ('agree' == $list['ispay']){
                        			echo '系统付款中';
                        		}else{
                        			echo '未付';
                        		}
                        	}
                        
                        ?></td>
                        <td class="ng-binding"><?php echo $list['bian']; ?></td>
                        <td class="ng-binding"><?php echo $wxInfo['nickname']; ?></td>
                        <td class="ng-binding"><img width="60" src="<?php echo $wxInfo['headimgurl']; ?>"></td>
                        <td class="ng-binding"><?php echo $list['name']; ?></td>
                        <td class="ng-binding"><?php echo $list['phone']; ?></td>
                        <td class="ng-binding"><?php echo $list['dian']; ?></td>
                        <td class="ng-binding"><img width="60" src="http://mei94.com/le/upload/<?php echo $list['pic']; ?>.jpg"></td>
                        <td class="ng-binding"><?php echo $list['createtime']; ?></td>
                        <td style="text-align: left">
                            <a href="?a=view&id=<?php echo $list['id']; ?>"><i class="fa fa-edit"></i>查看</a>
                         </td>
                    </tr>
                    <?php } ?>
                    
                   <!--  <tr ng-repeat="(key,item) in main" class="ng-scope">
                        <td class="ng-binding">1</td>
                        <td style="text-align: left" class="ng-binding">软件开发</td>
                        <td class="ng-binding">2008/08/08</td>

                        <td class="ng-binding">2009/08/08</td>
                        <td class="ng-binding">已完成</td>

                        <td class="ng-binding">2010/08/08</td>
                        <td class="ng-binding"></td>
                        <td class="ng-binding">6</td>
                        <td style="text-align: left">

                            <a href="#projectDetails" class="text-navy"><i class="fa fa-eye"></i> 详情</a>
                            <a href="#addProject?from=modify"><i class="fa fa-edit"></i>修改</a>

                            <div class="dropdown" style="display: inline">
                                <a class=" dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown">
                                    更多
                                    <span class="caret"></span>
                                </a>
                                <div class="dropdown-menu " style="margin-left: 40px;min-width: 85px" role="menu" aria-labelledby="dropdownMenu1">
                                    <p style="margin-left: 15px" role="presentation"><a role="menuitem" data-toggle="modal" data-target="#mymodal3" class="text-navy" tabindex="-1"><i class="fa fa-check"></i> 完成</a></p>
                                    <p style="margin-left: 15px" role="presentation"><a role="menuitem" data-toggle="modal" data-target="#mymodal4" class="text-danger" tabindex="-1"><i class="fa fa-remove"></i> 终止</a></p>
                                    <p style="margin-left: 15px" role="presentation"><a role="menuitem" class="text-danger" ng-click="del(key)" tabindex="-1"><i class="fa fa-trash"></i> 删除</a></p>
                                </div>
                        </div></td>
                    </tr> -->



                    </tbody>
                </table>


                <div class="hr-line-dashed"></div>
                <div class="text-right">
                    <ul class="pagination pagination">
                    <?php $pageUrl='?a=home&p='; ?>
                        <?php if($page > 1){ ?>
					    <li><a href="<?php echo $pageUrl,$page-1; ?>">«</a></li>
					    <?php }else{ ?> 
					    <li class="disabled"><a href="javascript:void(0)">«</a></li>
					    <?php } ?>
					    <?php if($page > 2){ ?><li><a href="<?php echo $pageUrl,$page-2; ?>"><?php echo $page-2; ?></a></li><?php } ?>
                        <?php if($page > 1){ ?><li><a href="<?php echo $pageUrl,$page-1; ?>"><?php echo $page-1; ?></a></li><?php } ?>
                        <li class="active"><a href="<?php echo $pageUrl,$page; ?>"><?php echo $page; ?></a></li>
                        <?php if(($page+1) <= $total_page){ ?><li><a href="<?php echo $pageUrl,$page+1; ?>" ><?php echo $page+1; ?></a></li><?php } ?>
                        <?php if(($page+2) <= $total_page){ ?><li><a href="<?php echo $pageUrl,$page+2; ?>" ><?php echo $page+2; ?></a></li><?php } ?>
                         
                        <?php if(($page+1) <= $total_page){ ?><li class="disabled"><a href="<?php echo $pageUrl,$page+1; ?>">»</a></li><?php }else{ ?>
                            <li class="disabled"><a href="javascript:void(0)">»</a></li>
                        <?php } ?> 
                         
                    </ul>
                </div>
            </div>
        </div>
    </div>



</div>

 
<div class="modal fade ng-scope" id="mymodal3">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
                <h4>提示</h4>
            </div>
            <div class="modal-body">
                <p>你是否同意发放红包，是否确认</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-success delyes" data-dismiss="modal">确认</button>
            </div>
        </div>
    </div>
</div>
 
</div>
</div>

<script src="js/jquery-2.2.4.min.js"></script>
<script src="js/toastr.js"></script>
<script src="js/easing.js"></script>
<script src="js/selectize.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/wangEditor.js"></script>
<script src="js/TileHeadPic.js"></script>
<script src="js/calendar.js"></script>
<script type="text/javascript">
$(function(){
	var _id=0;
	$(".mymodal3").click(function(){
		_id=$(this).attr("data-id");
		$('#mymodal3').modal('show');
		return false;
	});
	$(".delyes").click(function(){
		 window.location.href="?a=dopay&id="+_id;
	});

	 
});
</script>
</body></html>